home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
EDUCATE
/
VCLANG11.ARJ
/
VC.DOC
< prev
next >
Wrap
Text File
|
1991-06-12
|
11KB
|
282 lines
VisiCLANG -- A Visible Compiler for CLANG
===========================================
v1.10 (C)Copyright 1990, Univ. of Limerick
INTRODUCTION
------------
VisiCLANG is a tool to aid one in understanding the inner
workings of a compiler. It does this by allowing the user to
trace all aspects of a compiler's execution as it is compiling
the user's own program(s). Assembly language code is generated by
the compiler and then executed on an stack machine implemented in
software.
CLANG is a simple teaching language developed by P.D. Terry and
described by him as a "superset of a subset of Pascal". It limits
it's data types to integers and arrays of integers, but includes
data abstraction and concurrency. The CLANG compiler uses straight-
forward recursive-descent parsing implemented in "highly standard
Pascal".
CLANG (and the stack machine) is developed and explained in the
book "Programming Language Translation" by P.D. Terry (Addison-
Wesley, 1986). Level 5 of CLANG is used in VisiCLANG, and the
source code corresponds exactly with the listing given by Terry
in his book (pp. 379-411 ... or it can be written to a file from
within VisiCLANG). We recommend Terry's book for in-depth study
of CLANG and/or the stack machine. See also SIGPLAN Notices V25
#8, August 1990, for a general description of the compiler.
(A version of VisiCLANG for Level 2 of CLANG is also available;
contact the authors for more information.)
MODES OF OPERATION
------------------
There are two distinct modes of operation for VisiCLANG: compile
mode and execute mode. Compile mode allows the user to view a
program being compiled and, if compilation is successful, to save
the resultant code; execute mode allows the user to view the com-
piled program being executed on the stack machine (SM). Both
modes can be used independently of the other -- you need not
execute your compiled program and you can execute previously
saved SM code without re-compiling the source.
RUNNING VisiCLANG
-----------------
Usage: vc [options]
where options are:
<file> -- select compile mode and input CLANG file
/e[<file>] -- select execute mode and input SM code file
/h -- help
(anything delimited by [ ] denotes an optional part of a
command)
Note: Use `vc2' instead of `vc' if you have VisiCLANG for Level 2 of CLANG.
COMPILE MODE
------------
When first entering Compile Mode the user is prompted for the
name of an input file. This is the CLANG program which is to be
compiled, and it is used for all subsequent operations unless the
user specifies otherwise.
There are six primary windows in compile mode. These are:
CLANG Shows CLANG compiler source code, with the line
about to be executed highlighted.
Input Shows the user's CLANG source code file as seen by
the compiler -- one line at a time is read into a
buffer and then an arrow in the window indicates
exactly where the lexical analyzer is scanning in
the buffer.
Code Shows the SM code as it is generated.
Grammar Shows the trace through the CLANG grammar as it's
compiling your code. A parse tree can be built by
following highlighted elements down through the
window. The meta-language used is slightly modified
EBNF:
(1) The meta-symbols < > are used to denote non-
terminals (exception: the relational
operators).
(2) The symbol ::= should be read "is defined as"
(3) The vertical bar | should be read "or"
(4) Curly braces { } are used to denote repetition
of a string 0 or more times.
(5) Square brackets [ ] are used to denote an
optional item.
(6) The meta-symbols << >> are used to denote
certain terminals.
(7) Null productions are indicated by NULL.
(8) Symbols and words with none of the above punc-
tuation are terminals.
Procedure
List Traces the calls to procedures in the parser that
correspond to non-terminals in the grammar
Variable This is a pop-up window that allows the user to
watch any of the compiler's variables (with the
hopefully obvious restriction that you are current-
ly executing within the scope of the variable you
wish to watch).
EXECUTE MODE
------------
If execute mode is entered immediately after a successful
compilation, the code generated by the previous compilation will
be executed. Otherwise the user is prompted for the name of a
code file.
Execute mode has seven main windows:
CLANG As with Compile mode, shows the CLANG source, with
the line about to execute highlighted.
Input/
Output I/O window for program currently executing.
Code The complete SM program listing, with the next
instruction to be executed highlighted.
Stack Shows the SM's stack (with the first column being the
address, column 2 the contents). The base and top-of-
stack "pointers" are indicated with appropriate
symbols.
Display CLANG uses a display to handle variable addressing;
this window shows the current state of this display.
Source Shows a traces through the CLANG source as the
program is being executed; this window is not active
if you are executing SM code that has been directly
loaded in from a file.
Variable (Same as in compile mode)
COMMANDS
--------
The following function keys can be used in either mode:
F1 Help
F2 Search (searches for a string in the CLANG compiler
source)
F3 Goto line (in the CLANG compiler source code)
F4 Goto start (begin compiling your CLANG or SM source
program; necessary only if you wish to re-start compila-
tion/execution)
F5 New source file (choose a different CLANG/SM source
program & begin compilation/execution)
F6 Variables window (selects the variables window; user
will be prompted to add a variable if none have yet been
chosen)
F7 Cycle windows (cycles through screen windows; a window
must be selected before it is modified, with double-line
borders indicating the currently selected window.)
F8 Modify window (allows you to modify (move,resize,etc.)
the currently selected window)
F9 Switch modes (switches between compile & execute modes)
F10 Main menu
VisiCLANG allows you to watch different aspects of the compila-
tion/execution process at different rates as you step through
source code. The following keys can be used in this process:
(CM -- compile mode; EM -- execute mode)
<space bar> Single step through the CLANG compiler(CM) or
interpreter(EM) source code
B Go until breakpoint; pressing B with no breakpoints
will cause VisiCLANG to attempt to compile(CM) or
execute(EM) your entire program
C Go until code generated (CM) or executed(EM);
(CM -- compilation will continue until the next SM
instruction is generated; EM -- will single-step
you through the SM code)
G Go until grammar change; compilation will continue
until the grammar window is updated (CM only)
T Go until next token; compilation will continue
until the next token is returned by the lexical
analyzer (CM only)
P CM -- Go until procedure end; compilation continues
until you reach the end of the last procedure
listed in the Procedure List window
EM -- Show process list (if applicable)
> Add breakpoint; places a breakpoint on the current
line (the one highlighted) in the CLANG com-
piler(CM) or interpreter(EM) source.
< Clear breakpoint; removes the breakpoint on the
current line in the CLANG compiler(CM) or inter-
preter(EM) source.
A Clear all breakpoints (in the CLANG compiler(CM) or
interpreter(EM) source)
V or + Add variable; prompts you for the name and then
adds a variable to the variable watch window
- Delete variable; deletes highlighted variable from
the watch variable window; variables can be high-
lighted by first selecting the variable window (F6)
and then using the up/down arrow keys
H Hide variable window; "hides" or closes variable
window (note that F6 will re-open it)
Z Zap variable window; removes all variables from
variable window
S Show symbol table (CM only)
<Ctrl>L Repeat last search (initial search done with F2)
F Trace CLANG toggle; when on, the next line to be
executed in the CLANG compiler(CM) or interpreter
(EM) will be highlighted (turning Trace off will
noticeable speed up VisiCLANG)
K Pause on token toggle; when on, VisiCLANG will pause
whenever a token has been recognized (CM only)
D Set Delay; allows you to control the speed at which
the compiler will run (delays are inserted after
each line of CLANG executed)
Q Quit VisiCLANG
The following keys are available whenever a scrolling window has
been selected:
<up arrow>/<down arrow> Scroll up/down one line
<PgUp>/<PgDn> Scroll up/down one screen
<Home>/<End> Scroll to start/end of window
Note that if a window is too small to show an entire line, the
size of the window can be modified using F8.
FILES ON DISK
-------------
read.me special instructions
vc*.exe VisiCLANG executable
vc*.ov* VisiCLANG overlay files (do not delete!)
vc*.cfg VisiCLANG configuration file (stores status of
VisiCLANG upon exit from program; deletion or renaming
will cause VisiCLANG to begin with default set-up)
vc.doc this document
*.cln CLANG source code files
*.cod SM source code files
TERMS AND CONDITIONS OF USE
---------------------------
YOU MAY FREELY COPY AND DISTRIBUTE VERBATIM COPIES OF VISICLANG
AS LONG AS YOU ALSO DISTRIBUTE ALL COPYRIGHT NOTICES AND DIS-
CLAIMERS OF WARRANTY. THE PROGRAM IS DISTRIBUTED "AS IS" WITHOUT
WARRANTY OF ANY KIND -- THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE SOFTWARE IS WITH THE USER. WHILE WE ENCOURAGE
ANY FEEDBACK AND SUGGESTIONS, FUTURE SUPPORT OF THIS PRODUCT BY
THE AUTHORS OR THE UNIVERSITY IS NOT GUARANTEED.
Any comments/suggestions/gripes? Here's our address:
Dan Resler
Keith O'Sullivan
Dept. of Electronics & Computer Engineering,
University of Limerick,
Limerick, Ireland
email: reslerd@ul.ie
phone: Ireland 061-333644
fax : Ireland 061-330316